﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ELTE.SEM.Data
{
    public class BaseSemData
    {
        public string Title { get; set; }
        public List<KeyValuePair<string, string>> UnknownValues { get; set; }
        public List<KeyValuePair<string, string>> UnProcessedValues { get; set; }

        public BaseSemData(string entryToParse)
        {
            Title = this.GetType().Name;
            UnknownValues = new List<KeyValuePair<string, string>>();
            UnProcessedValues = new List<KeyValuePair<string, string>>();
            //mivel a megkapott
            Parse(entryToParse.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries));
        }

        public virtual void Parse(string[] fields)
        {
            foreach (string field in fields)
            {
                string[] nameAndValue = field.Split(new char[] { '=' });
                if (nameAndValue != null && nameAndValue.Length == 2)
                {
                    //ha két elemet tartalmaz a tömbünk, akkor az első elem a név, a második pedig az érték
                    UnProcessedValues.Add(new KeyValuePair<string, string>(nameAndValue[0], nameAndValue[1]));
                }
            }
        }
    }

    public class SemUser : BaseSemData
    {
        public string Date { get; set; }
        public string Time { get; set; }
        public string User { get; set; }
        public string UserText { get; set; }
        public string UserTextUnicode { get; set; }

        public SemUser(string entryToParse)
            : base(entryToParse)
        {
        }

        public override void Parse(string[] fields)
        {
            try
            {
                base.Parse(fields);
                UnProcessedValues.ForEach(kvp =>
                {
                    switch (kvp.Key)
                    {
                        case "Date":
                            this.Date = kvp.Value;
                            break;
                        case "Time": Time = kvp.Value;
                            break;
                        case "User": User = kvp.Value;
                            break;
                        case "UserText": UserText = kvp.Value;
                            break;
                        case "UserTextUnicode": UserTextUnicode = kvp.Value;
                            break;
                        default:
                            UnknownValues.Add(kvp);
                            break;
                    }
                });
            }
            catch (Exception ex)
            {

            }

        }
    }

    public class SemSystem : BaseSemData
    {
        public string Type { get; set; }
        public string Dnumber { get; set; }
        public string Software { get; set; }
        public string BuildNr { get; set; }
        public string Source { get; set; }
        public string Column { get; set; }
        public string FinalLens { get; set; }
        public string Chamber { get; set; }
        public string Stage { get; set; }
        public string Pump { get; set; }
        public string ESEM { get; set; }
        public string Aperture { get; set; }
        public string Scan { get; set; }
        public string Acq { get; set; }
        public string EucWD { get; set; }
        public string SystemType { get; set; }
        public string DisplayWidth { get; set; }
        public string DisplayHeight { get; set; }

        public SemSystem(string entryToParse)
            : base(entryToParse)
        {
        }

        public override void Parse(string[] fields)
        {
            base.Parse(fields);
            UnProcessedValues.ForEach(kvp =>
            {
                switch (kvp.Key)
                {
                    case "Type": Type = kvp.Value;
                        break;
                    case "Dnumber": Dnumber = kvp.Value;
                        break;
                    case "Software": Software = kvp.Value;
                        break;
                    case "BuildNr": BuildNr = kvp.Value;
                        break;
                    case "Source": Source = kvp.Value;
                        break;
                    case "Column": Column = kvp.Value;
                        break;
                    case "FinalLens": FinalLens = kvp.Value;
                        break;
                    case "Chamber": Chamber = kvp.Value;
                        break;
                    case "Stage": Stage = kvp.Value;
                        break;
                    case "Pump": Pump = kvp.Value;
                        break;
                    case "ESEM": ESEM = kvp.Value;
                        break;
                    case "Aperture": Aperture = kvp.Value;
                        break;
                    case "Scan": Scan = kvp.Value;
                        break;
                    case "Acq": Acq = kvp.Value;
                        break;
                    case "EucWD": EucWD = kvp.Value;
                        break;
                    case "SystemType": SystemType = kvp.Value;
                        break;
                    case "DisplayWidth": DisplayWidth = kvp.Value;
                        break;
                    case "DisplayHeight": DisplayHeight = kvp.Value;
                        break;
                    default:
                        UnknownValues.Add(kvp);
                        break;
                }
            });
        }
    }

    public class SemBeam : BaseSemData
    {
        public string HV { get; set; }
        public string Spot { get; set; }
        public string StigmatorX { get; set; }
        public string StigmatorY { get; set; }
        public string BeamShiftX { get; set; }
        public string BeamShiftY { get; set; }
        public string ScanRotation { get; set; }
        public string ImageMode { get; set; }
        public string Beam { get; set; }
        public string Scan { get; set; }

        public SemBeam(string entryToParse)
            : base(entryToParse) { }

        public override void Parse(string[] fields)
        {
            base.Parse(fields);
            UnProcessedValues.ForEach(kvp =>
            {
                switch (kvp.Key)
                {
                    case "HV": HV = kvp.Value;
                        break;
                    case "Spot": Spot = kvp.Value;
                        break;
                    case "StigmatorX": StigmatorX = kvp.Value;
                        break;
                    case "StigmatorY": StigmatorY = kvp.Value;
                        break;
                    case "BeamShiftX": BeamShiftX = kvp.Value;
                        break;
                    case "BeamShiftY": BeamShiftY = kvp.Value;
                        break;
                    case "ScanRotation": ScanRotation = kvp.Value;
                        break;
                    case "ImageMode": ImageMode = kvp.Value;
                        break;
                    case "Beam": Beam = kvp.Value;
                        break;
                    case "Scan": Scan = kvp.Value;
                        break;
                    default:
                        UnknownValues.Add(kvp);
                        break;
                }
            });
        }
    }

    public class SemEBeam : BaseSemData
    {
        public string Source { get; set; }
        public string ColumnType { get; set; }
        public string FinalLens { get; set; }
        public string Acq { get; set; }
        public string Aperture { get; set; }
        public string ApertureDiameter { get; set; }
        public string HV { get; set; }
        public string HFW { get; set; }
        public string VFW { get; set; }
        public string WD { get; set; }
        public string BeamCurrent { get; set; }
        public string TiltCorrectionIsOn { get; set; }
        public string DynamicFocusIsOn { get; set; }
        public string ScanRotation { get; set; }
        public string LensMode { get; set; }
        public string SemOpticalMode { get; set; }
        public string ImageMode { get; set; }
        public string SourceTiltX { get; set; }
        public string SourceTiltY { get; set; }
        public string StageX { get; set; }
        public string StageY { get; set; }
        public string StageZ { get; set; }
        public string StageR { get; set; }
        public string StageTa { get; set; }
        public string StageTb { get; set; }
        public string StigmatorX { get; set; }
        public string StigmatorY { get; set; }
        public string BeamShiftX { get; set; }
        public string BeamShiftY { get; set; }
        public string EucWD { get; set; }
        public string EmissionCurrent { get; set; }
        public string TiltCorrectionAngle { get; set; }
        public string PreTilt { get; set; }
        public string WehneltBias { get; set; }

        public SemEBeam(string entryToParse)
            : base(entryToParse) { }

        public override void Parse(string[] fields)
        {
            base.Parse(fields);
            UnProcessedValues.ForEach(kvp =>
            {
                switch (kvp.Key)
                {
                    case "Source":
                        Source = kvp.Value;
                        break;
                    case "ColumnType": ColumnType = kvp.Value;
                        break;
                    case "FinalLens": FinalLens = kvp.Value;
                        break;
                    case "Acq": Acq = kvp.Value;
                        break;
                    case "Aperture": Aperture = kvp.Value;
                        break;
                    case "ApertureDiameter": ApertureDiameter = kvp.Value;
                        break;
                    case "HV": HV = kvp.Value;
                        break;
                    case "HFW": HFW = kvp.Value;
                        break;
                    case "VFW": VFW = kvp.Value;
                        break;
                    case "WD": WD = kvp.Value;
                        break;
                    case "BeamCurrent": BeamCurrent = kvp.Value;
                        break;
                    case "TiltCorrectionIsOn": TiltCorrectionIsOn = kvp.Value;
                        break;
                    case "DynamicFocusIsOn": DynamicFocusIsOn = kvp.Value;
                        break;
                    case "ScanRotation": ScanRotation = kvp.Value;
                        break;
                    case "LensMode": LensMode = kvp.Value;
                        break;
                    case "SemOpticalMode": SemOpticalMode = kvp.Value;
                        break;
                    case "ImageMode": ImageMode = kvp.Value;
                        break;
                    case "SourceTiltX": SourceTiltX = kvp.Value;
                        break;
                    case "SourceTiltY": SourceTiltY = kvp.Value;
                        break;
                    case "StageX": StageX = kvp.Value;
                        break;
                    case "StageY": StageY = kvp.Value;
                        break;
                    case "StageZ": StageZ = kvp.Value;
                        break;
                    case "StageR": StageR = kvp.Value;
                        break;
                    case "StageTa": StageTa = kvp.Value;
                        break;
                    case "StageTb": StageTb = kvp.Value;
                        break;
                    case "StigmatorX": StigmatorX = kvp.Value;
                        break;
                    case "StigmatorY": StigmatorY = kvp.Value;
                        break;
                    case "BeamShiftX": BeamShiftX = kvp.Value;
                        break;
                    case "BeamShiftY": BeamShiftY = kvp.Value;
                        break;
                    case "EucWD": EucWD = kvp.Value;
                        break;
                    case "EmissionCurrent": EmissionCurrent = kvp.Value;
                        break;
                    case "TiltCorrectionAngle": TiltCorrectionAngle = kvp.Value;
                        break;
                    case "PreTilt": PreTilt = kvp.Value;
                        break;
                    case "WehneltBias": WehneltBias = kvp.Value;
                        break;
                    default:
                        UnknownValues.Add(kvp);
                        break;
                }
            });
        }
    }

    public class SemGIS : BaseSemData
    {
        public string Number { get; set; }

        public SemGIS(string entryToParse)
            : base(entryToParse) { }

        public override void Parse(string[] fields)
        {
            base.Parse(fields);
            UnProcessedValues.ForEach(kvp =>
            {
                switch (kvp.Key)
                {
                    case "Number": Number = kvp.Value;
                        break;
                    default:
                        UnknownValues.Add(kvp);
                        break;
                }
            });
        }
    }
    public class SemGIS1 : BaseSemData
    {
        public string GasType { get; set; }
        public string HeaterState { get; set; }
        public string NeedleState { get; set; }
        public string GasFlow { get; set; }
        public string Port { get; set; }

        public SemGIS1(string entryToParse)
            : base(entryToParse) { }

        public override void Parse(string[] fields)
        {
            base.Parse(fields);
            UnProcessedValues.ForEach(kvp =>
            {
                switch (kvp.Key)
                {
                    case "GasType": GasType = kvp.Value;
                        break;
                    case "HeaterState": HeaterState = kvp.Value;
                        break;
                    case "NeedleState": NeedleState = kvp.Value;
                        break;
                    case "GasFlow": GasFlow = kvp.Value;
                        break;
                    case "Port": Port = kvp.Value;
                        break;
                    default:
                        UnknownValues.Add(kvp);
                        break;
                }
            });
        }
    }
    public class SemGIS2 : BaseSemData
    {
        public string GasType { get; set; }
        public string HeaterState { get; set; }
        public string NeedleState { get; set; }
        public string GasFlow { get; set; }
        public string Port { get; set; }

        public SemGIS2(string entryToParse)
            : base(entryToParse) { }

        public override void Parse(string[] fields)
        {
            base.Parse(fields);
            UnProcessedValues.ForEach(kvp =>
            {
                switch (kvp.Key)
                {
                    case "GasType": GasType = kvp.Value;
                        break;
                    case "HeaterState": HeaterState = kvp.Value;
                        break;
                    case "NeedleState": NeedleState = kvp.Value;
                        break;
                    case "GasFlow": GasFlow = kvp.Value;
                        break;
                    case "Port": Port = kvp.Value;
                        break;
                    default:
                        UnknownValues.Add(kvp);
                        break;
                }
            });
        }
    }

    public class SemGIS3 : BaseSemData
    {
        public string GasType { get; set; }
        public string HeaterState { get; set; }
        public string NeedleState { get; set; }
        public string GasFlow { get; set; }
        public string Port { get; set; }

        public SemGIS3(string entryToParse)
            : base(entryToParse) { }

        public override void Parse(string[] fields)
        {
            base.Parse(fields);
            UnProcessedValues.ForEach(kvp =>
            {
                switch (kvp.Key)
                {
                    case "GasType": GasType = kvp.Value;
                        break;
                    case "HeaterState": HeaterState = kvp.Value;
                        break;
                    case "NeedleState": NeedleState = kvp.Value;
                        break;
                    case "GasFlow": GasFlow = kvp.Value;
                        break;
                    case "Port": Port = kvp.Value;
                        break;
                    default:
                        UnknownValues.Add(kvp);
                        break;
                }
            });
        }
    }

    public class SemScan : BaseSemData
    {
        public string InternalScan { get; set; }
        public string Dwelltime { get; set; }
        public string PixelWidth { get; set; }
        public string PixelHeight { get; set; }
        public string HorFieldsize { get; set; }
        public string VerFieldsize { get; set; }
        public string Average { get; set; }
        public string Integrate { get; set; }
        public string FrameTime { get; set; }

        public SemScan(string entryToParse)
            : base(entryToParse) { }

        public override void Parse(string[] fields)
        {
            base.Parse(fields);
            UnProcessedValues.ForEach(kvp =>
            {
                switch (kvp.Key)
                {
                    case "InternalScan": InternalScan = kvp.Value;
                        break;
                    case "Dwelltime": Dwelltime = kvp.Value;
                        break;
                    case "PixelWidth": PixelWidth = kvp.Value;
                        break;
                    case "PixelHeight": PixelHeight = kvp.Value;
                        break;
                    case "HorFieldsize": HorFieldsize = kvp.Value;
                        break;
                    case "VerFieldsize": VerFieldsize = kvp.Value;
                        break;
                    case "Average": Average = kvp.Value;
                        break;
                    case "Integrate": Integrate = kvp.Value;
                        break;
                    case "FrameTime": FrameTime = kvp.Value;
                        break;
                    default:
                        UnknownValues.Add(kvp);
                        break;
                }
            });
        }
    }

    public class SemEScan : BaseSemData
    {
        public string Scan { get; set; }
        public string InternalScan { get; set; }
        public string Dwell { get; set; }
        public string PixelWidth { get; set; }
        public string PixelHeight { get; set; }
        public string HorFieldsize { get; set; }
        public string VerFieldsize { get; set; }
        public string FrameTime { get; set; }
        public string LineTime { get; set; }
        public string Mainslock { get; set; }

        public SemEScan(string entryToParse)
            : base(entryToParse) { }

        public override void Parse(string[] fields)
        {
            base.Parse(fields);
            UnProcessedValues.ForEach(kvp =>
            {
                switch (kvp.Key)
                {
                    case "Scan": Scan = kvp.Value;
                        break;
                    case "InternalScan": InternalScan = kvp.Value;
                        break;
                    case "Dwell": Dwell = kvp.Value;
                        break;
                    case "PixelWidth": PixelWidth = kvp.Value;
                        break;
                    case "PixelHeight": PixelHeight = kvp.Value;
                        break;
                    case "HorFieldsize": HorFieldsize = kvp.Value;
                        break;
                    case "VerFieldsize": VerFieldsize = kvp.Value;
                        break;
                    case "FrameTime": FrameTime = kvp.Value;
                        break;
                    case "LineTime": LineTime = kvp.Value;
                        break;
                    case "Mainslock": Mainslock = kvp.Value;
                        break;
                    default:
                        UnknownValues.Add(kvp);
                        break;
                }
            });
        }
    }

    public class SemStage : BaseSemData
    {
        public string StageX { get; set; }
        public string StageY { get; set; }
        public string StageZ { get; set; }
        public string StageR { get; set; }
        public string StageT { get; set; }
        public string StageTb { get; set; }
        public string SpecTilt { get; set; }
        public string WorkingDistance { get; set; }

        public SemStage(string entryToParse)
            : base(entryToParse) { }

        public override void Parse(string[] fields)
        {
            base.Parse(fields);
            UnProcessedValues.ForEach(kvp =>
            {
                switch (kvp.Key)
                {
                    case "StageX": StageX = kvp.Value;
                        break;
                    case "StageY": StageY = kvp.Value;
                        break;
                    case "StageZ": StageZ = kvp.Value;
                        break;
                    case "StageR": StageR = kvp.Value;
                        break;
                    case "StageT": StageT = kvp.Value;
                        break;
                    case "StageTb": StageTb = kvp.Value;
                        break;
                    case "SpecTilt": SpecTilt = kvp.Value;
                        break;
                    case "WorkingDistance": WorkingDistance = kvp.Value;
                        break;
                    default:
                        UnknownValues.Add(kvp);
                        break;
                }
            });
        }
    }
    public class SemImage : BaseSemData
    {
        public string DigitalContrast { get; set; }
        public string DigitalBrightness { get; set; }
        public string DigitalGamma { get; set; }
        public string Average { get; set; }
        public string ResolutionX { get; set; }
        public string ResolutionY { get; set; }
        public string ZoomFactor { get; set; }
        public string MagCanvasRealWidth { get; set; }
        public string MagnificationMode { get; set; }
        public string Integrate { get; set; }

        public SemImage(string entryToParse)
            : base(entryToParse) { }

        public override void Parse(string[] fields)
        {
            base.Parse(fields);
            UnProcessedValues.ForEach(kvp =>
            {
                switch (kvp.Key)
                {
                    case "DigitalContrast": DigitalContrast = kvp.Value;
                        break;
                    case "DigitalBrightness": DigitalBrightness = kvp.Value;
                        break;
                    case "DigitalGamma": DigitalGamma = kvp.Value;
                        break;
                    case "Average": Average = kvp.Value;
                        break;
                    case "ResolutionX": ResolutionX = kvp.Value;
                        break;
                    case "ResolutionY": ResolutionY = kvp.Value;
                        break;
                    case "ZoomFactor": ZoomFactor = kvp.Value;
                        break;
                    case "MagCanvasRealWidth": MagCanvasRealWidth = kvp.Value;
                        break;
                    case "MagnificationMode": MagnificationMode = kvp.Value;
                        break;
                    case "Integrate": Integrate = kvp.Value;
                        break;
                    default:
                        UnknownValues.Add(kvp);
                        break;
                }
            });
        }
    }

    public class SemVacuum : BaseSemData
    {
        public string ChPressure { get; set; }
        public string Gas { get; set; }
        public string UserMode { get; set; }
        public string Humidity { get; set; }

        public SemVacuum(string entryToParse)
            : base(entryToParse) { }

        public override void Parse(string[] fields)
        {
            base.Parse(fields);
            UnProcessedValues.ForEach(kvp =>
            {
                switch (kvp.Key)
                {
                    case "ChPressure": ChPressure = kvp.Value;
                        break;
                    case "Gas": Gas = kvp.Value;
                        break;
                    case "UserMode": UserMode = kvp.Value;
                        break;
                    case "Humidity": Humidity = kvp.Value;
                        break;
                    default:
                        UnknownValues.Add(kvp);
                        break;
                }
            });
        }
    }

    public class SemSpecimen : BaseSemData
    {
        public string Temperature { get; set; }

        public SemSpecimen(string entryToParse)
            : base(entryToParse) { }

        public override void Parse(string[] fields)
        {
            base.Parse(fields);
            UnProcessedValues.ForEach(kvp =>
            {
                switch (kvp.Key)
                {
                    case "Temperature": Temperature = kvp.Value;
                        break;
                    default:
                        UnknownValues.Add(kvp);
                        break;
                }
            });
        }
    }

    public class SemDetectors : BaseSemData
    {
        public string Number { get; set; }
        public string Name { get; set; }
        public string Mode { get; set; }

        public SemDetectors(string entryToParse)
            : base(entryToParse) { }

        public override void Parse(string[] fields)
        {
            base.Parse(fields);
            UnProcessedValues.ForEach(kvp =>
            {
                switch (kvp.Key)
                {
                    case "Number": Number = kvp.Value;
                        break;
                    case "Name": Name = kvp.Value;
                        break;
                    case "Mode": Mode = kvp.Value;
                        break;
                    default:
                        UnknownValues.Add(kvp);
                        break;
                }
            });
        }
    }

    public class SemETD : BaseSemData
    {
        public string Contrast { get; set; }
        public string Brightness { get; set; }
        public string Mix { get; set; }
        public string Signal { get; set; }
        public string Grid { get; set; }
        public string ContrastDB { get; set; }
        public string BrightnessDB { get; set; }
        public string Setting { get; set; }
        public string MinimumDwellTime { get; set; }

        public SemETD(string entryToParse)
            : base(entryToParse) { }

        public override void Parse(string[] fields)
        {
            base.Parse(fields);
            UnProcessedValues.ForEach(kvp =>
            {
                switch (kvp.Key)
                {
                    case "Contrast": Contrast = kvp.Value;
                        break;
                    case "Brightness": Brightness = kvp.Value;
                        break;
                    case "Mix": Mix = kvp.Value;
                        break;
                    case "Signal": Signal = kvp.Value;
                        break;
                    case "Grid": Grid = kvp.Value;
                        break;
                    case "ContrastDB": ContrastDB = kvp.Value;
                        break;
                    case "BrightnessDB": BrightnessDB = kvp.Value;
                        break;
                    case "Setting": Setting = kvp.Value;
                        break;
                    case "MinimumDwellTime": MinimumDwellTime = kvp.Value;
                        break;
                    default:
                        UnknownValues.Add(kvp);
                        break;
                }
            });
        }
    }

    public class SemAccessories : BaseSemData
    {
        public string Number { get; set; }

        public SemAccessories(string entryToParse)
            : base(entryToParse) { }

        public override void Parse(string[] fields)
        {
            base.Parse(fields);
            UnProcessedValues.ForEach(kvp =>
            {
                switch (kvp.Key)
                {
                    case "Number": Number = kvp.Value;
                        break;
                    default:
                        UnknownValues.Add(kvp);
                        break;
                }
            });
        }
    }

    public class SemEBeamDeceleration : BaseSemData
    {
        public string ModeOn { get; set; }
        public string LandingEnergy { get; set; }
        public string ImmersionRatio { get; set; }
        public string StageBias { get; set; }

        public SemEBeamDeceleration(string entryToParse)
            : base(entryToParse) { }

        public override void Parse(string[] fields)
        {
            base.Parse(fields);
            UnProcessedValues.ForEach(kvp =>
            {
                switch (kvp.Key)
                {
                    case "ModeOn": ModeOn = kvp.Value;
                        break;
                    case "LandingEnergy": LandingEnergy = kvp.Value;
                        break;
                    case "ImmersionRatio": ImmersionRatio = kvp.Value;
                        break;
                    case "StageBias": StageBias = kvp.Value;
                        break;
                    default:
                        UnknownValues.Add(kvp);
                        break;
                }
            });
        }
    }

    public class SemPrivateFei : BaseSemData
    {
        public string BitShift { get; set; }
        public string DataBarSelected { get; set; }
        public string DataBarAvailable { get; set; }
        public string DatabarHeight { get; set; }
        public string TimeOfCreation { get; set; }

        public SemPrivateFei(string entryToParse)
            : base(entryToParse) { }

        public override void Parse(string[] fields)
        {
            base.Parse(fields);
            UnProcessedValues.ForEach(kvp =>
            {
                switch (kvp.Key)
                {
                    case "BitShift": BitShift = kvp.Value;
                        break;
                    case "DataBarSelected": DataBarSelected = kvp.Value;
                        break;
                    case "DataBarAvailable": DataBarAvailable = kvp.Value;
                        break;
                    case "DatabarHeight": DatabarHeight = kvp.Value;
                        break;
                    case "TimeOfCreation": TimeOfCreation = kvp.Value;
                        break;
                    default:
                        UnknownValues.Add(kvp);
                        break;
                }
            });
        }
    }

    public class SemQuadBSD : BaseSemData
    {

        public string Contrast { get; set; }
        public string Brightness { get; set; }
        public string Signal { get; set; }
        public string Mix { get; set; }
        public string ContrastDB { get; set; }
        public string BrightnessDB { get; set; }
        public string Setting { get; set; }
        public string MinimumDwellTime { get; set; }

        public SemQuadBSD(string entryToParse)
            : base(entryToParse) { }

        public override void Parse(string[] fields)
        {
            base.Parse(fields);
            UnProcessedValues.ForEach(kvp =>
            {
                switch (kvp.Key)
                {
                    case "Contrast": Contrast = kvp.Value;
                        break;
                    case "Brightness": Brightness = kvp.Value;
                        break;
                    case "Signal": Signal = kvp.Value;
                        break;
                    case "Mix": Mix = kvp.Value;
                        break;
                    case "ContrastDB": ContrastDB = kvp.Value;
                        break;
                    case "BrightnessDB": BrightnessDB = kvp.Value;
                        break;
                    case "Setting": Setting = kvp.Value;
                        break;
                    case "MinimumDwellTime": MinimumDwellTime = kvp.Value;
                        break;
                    default:
                        UnknownValues.Add(kvp);
                        break;
                }
            });
        }
    }

    public class SemGSED : BaseSemData
    {
        public string Contrast { get; set; }
        public string Brightness { get; set; }
        public string EnhancedContrast { get; set; }
        public string Mix { get; set; }
        public string Signal { get; set; }
        public string ContrastDB { get; set; }
        public string BrightnessDB { get; set; }
        public string EnhancedContrastDB { get; set; }
        public string MinimumDwellTime { get; set; }

        public SemGSED(string entryToParse)
            : base(entryToParse) { }

        public override void Parse(string[] fields)
        {
            base.Parse(fields);
            UnProcessedValues.ForEach(kvp =>
            {
                switch (kvp.Key)
                {
                    case "Contrast": Contrast = kvp.Value;
                        break;
                    case "Brightness": Brightness = kvp.Value;
                        break;
                    case "EnhancedContrast": EnhancedContrast = kvp.Value;
                        break;
                    case "Mix": Mix = kvp.Value;
                        break;
                    case "Signal": Signal = kvp.Value;
                        break;
                    case "ContrastDB": ContrastDB = kvp.Value;
                        break;
                    case "BrightnessDB": BrightnessDB = kvp.Value;
                        break;
                    case "EnhancedContrastDB": EnhancedContrastDB = kvp.Value;
                        break;
                    case "MinimumDwellTime": MinimumDwellTime = kvp.Value;
                        break;
                    default:
                        UnknownValues.Add(kvp);
                        break;
                }
            });
        }
    }

    public class SemvCD : BaseSemData
    {
        public string Contrast { get; set; }
        public string Brightness { get; set; }
        public string Signal { get; set; }
        public string ContrastDB { get; set; }
        public string BrightnessDB { get; set; }
        public string MinimumDwellTime { get; set; }

        public SemvCD(string entryToParse)
            : base(entryToParse) { }

        public override void Parse(string[] fields)
        {
            base.Parse(fields);
            UnProcessedValues.ForEach(kvp =>
            {
                switch (kvp.Key)
                {
                    case "Contrast": Contrast = kvp.Value;
                        break;
                    case "Brightness": Brightness = kvp.Value;
                        break;
                    case "Signal": Signal = kvp.Value;
                        break;
                    case "ContrastDB": ContrastDB = kvp.Value;
                        break;
                    case "BrightnessDB": BrightnessDB = kvp.Value;
                        break;
                    case "MinimumDwellTime": MinimumDwellTime = kvp.Value;
                        break;
                    default:
                        UnknownValues.Add(kvp);
                        break;
                }
            });
        }
    }

    public class SemCDEM : BaseSemData
    {
        public string Contrast { get; set; }
        public string Brightness { get; set; }
        public string Signal { get; set; }
        public string ContrastDB { get; set; }
        public string BrightnessDB { get; set; }
        public string GridVoltage { get; set; }
        public string FrontEndVoltage { get; set; }
        public string EnhancedContrast { get; set; }
        public string MinimumDwellTime { get; set; }

        public SemCDEM(string entryToParse)
            : base(entryToParse) { }

        public override void Parse(string[] fields)
        {
            base.Parse(fields);
            UnProcessedValues.ForEach(kvp =>
            {
                switch (kvp.Key)
                {
                    case "Contrast": Contrast = kvp.Value;
                        break;
                    case "Brightness": Brightness = kvp.Value;
                        break;
                    case "Signal": Signal = kvp.Value;
                        break;
                    case "ContrastDB": ContrastDB = kvp.Value;
                        break;
                    case "BrightnessDB": BrightnessDB = kvp.Value;
                        break;
                    case "GridVoltage": GridVoltage = kvp.Value;
                        break;
                    case "FrontEndVoltage": FrontEndVoltage = kvp.Value;
                        break;
                    case "EnhancedContrast": EnhancedContrast = kvp.Value;
                        break;
                    case "MinimumDwellTime": MinimumDwellTime = kvp.Value;
                        break;
                    default:
                        UnknownValues.Add(kvp);
                        break;
                }
            });
        }
    }

    public class SemLVSED : BaseSemData
    {
        public string Contrast { get; set; }
        public string Brightness { get; set; }
        public string EnhancedContrast { get; set; }
        public string Mix { get; set; }
        public string Signal { get; set; }
        public string ContrastDB { get; set; }
        public string BrightnessDB { get; set; }
        public string EnhancedContrastDB { get; set; }
        public string MinimumDwellTime { get; set; }

        public SemLVSED(string entryToParse)
            : base(entryToParse) { }

        public override void Parse(string[] fields)
        {
            base.Parse(fields);
            UnProcessedValues.ForEach(kvp =>
            {
                switch (kvp.Key)
                {
                    case "Contrast": Contrast = kvp.Value;
                        break;
                    case "Brightness": Brightness = kvp.Value;
                        break;
                    case "EnhancedContrast": EnhancedContrast = kvp.Value;
                        break;
                    case "Mix": Mix = kvp.Value;
                        break;
                    case "Signal": Signal = kvp.Value;
                        break;
                    case "ContrastDB": ContrastDB = kvp.Value;
                        break;
                    case "BrightnessDB": BrightnessDB = kvp.Value;
                        break;
                    case "EnhancedContrastDB": EnhancedContrastDB = kvp.Value;
                        break;
                    case "MinimumDwellTime": MinimumDwellTime = kvp.Value;
                        break;
                    default:
                        UnknownValues.Add(kvp);
                        break;
                }
            });
        }

    }

    public class SemIBeam : BaseSemData
    {
        public string Source { get; set; }
        public string ColumnType { get; set; }
        public string FinalLens { get; set; }
        public string Acq { get; set; }
        public string Aperture { get; set; }
        public string ApertureDiameter { get; set; }
        public string HV { get; set; }
        public string HFW { get; set; }
        public string VFW { get; set; }
        public string WD { get; set; }
        public string BeamCurrent { get; set; }
        public string TiltCorrectionIsOn { get; set; }
        public string DynamicFocusIsOn { get; set; }
        public string ScanRotation { get; set; }
        public string LensMode { get; set; }
        public string SemOpticalMode { get; set; }
        public string ImageMode { get; set; }
        public string SourceTiltX { get; set; }
        public string SourceTiltY { get; set; }
        public string StageX { get; set; }
        public string StageY { get; set; }
        public string StageZ { get; set; }
        public string StageR { get; set; }
        public string StageTa { get; set; }
        public string StageTb { get; set; }
        public string StigmatorX { get; set; }
        public string StigmatorY { get; set; }
        public string BeamShiftX { get; set; }
        public string BeamShiftY { get; set; }
        public string EucWD { get; set; }
        public string EmissionCurrent { get; set; }
        public string TiltCorrectionAngle { get; set; }
        public string PreTilt { get; set; }
        public string WehneltBias { get; set; }

        public SemIBeam(string entryToParse)
            : base(entryToParse) { }

        public override void Parse(string[] fields)
        {
            base.Parse(fields);
            UnProcessedValues.ForEach(kvp =>
            {
                switch (kvp.Key)
                {
                    case "Source": Source = kvp.Value;
                        break;
                    case "ColumnType": ColumnType = kvp.Value;
                        break;
                    case "FinalLens": FinalLens = kvp.Value;
                        break;
                    case "Acq": Acq = kvp.Value;
                        break;
                    case "Aperture": Aperture = kvp.Value;
                        break;
                    case "ApertureDiameter": ApertureDiameter = kvp.Value;
                        break;
                    case "HV": HV = kvp.Value;
                        break;
                    case "HFW": HFW = kvp.Value;
                        break;
                    case "VFW": VFW = kvp.Value;
                        break;
                    case "WD": WD = kvp.Value;
                        break;
                    case "BeamCurrent": BeamCurrent = kvp.Value;
                        break;
                    case "TiltCorrectionIsOn": TiltCorrectionIsOn = kvp.Value;
                        break;
                    case "DynamicFocusIsOn": DynamicFocusIsOn = kvp.Value;
                        break;
                    case "ScanRotation": ScanRotation = kvp.Value;
                        break;
                    case "LensMode": LensMode = kvp.Value;
                        break;
                    case "SemOpticalMode": SemOpticalMode = kvp.Value;
                        break;
                    case "ImageMode": ImageMode = kvp.Value;
                        break;
                    case "SourceTiltX": SourceTiltX = kvp.Value;
                        break;
                    case "SourceTiltY": SourceTiltY = kvp.Value;
                        break;
                    case "StageX": StageX = kvp.Value;
                        break;
                    case "StageY": StageY = kvp.Value;
                        break;
                    case "StageZ": StageZ = kvp.Value;
                        break;
                    case "StageR": StageR = kvp.Value;
                        break;
                    case "StageTa": StageTa = kvp.Value;
                        break;
                    case "StageTb": StageTb = kvp.Value;
                        break;
                    case "StigmatorX": StigmatorX = kvp.Value;
                        break;
                    case "StigmatorY": StigmatorY = kvp.Value;
                        break;
                    case "BeamShiftX": BeamShiftX = kvp.Value;
                        break;
                    case "BeamShiftY": BeamShiftY = kvp.Value;
                        break;
                    case "EucWD": EucWD = kvp.Value;
                        break;
                    case "EmissionCurrent": EmissionCurrent = kvp.Value;
                        break;
                    case "TiltCorrectionAngle": TiltCorrectionAngle = kvp.Value;
                        break;
                    case "PreTilt": PreTilt = kvp.Value;
                        break;
                    case "WehneltBias": WehneltBias = kvp.Value;
                        break;
                    default:
                        UnknownValues.Add(kvp);
                        break;
                }
            });
        }
    }

    public class SemIScan : BaseSemData
    {
        public string Scan { get; set; }
        public string InternalScan { get; set; }
        public string Dwell { get; set; }
        public string PixelWidth { get; set; }
        public string PixelHeight { get; set; }
        public string HorFieldsize { get; set; }
        public string VerFieldsize { get; set; }
        public string FrameTime { get; set; }
        public string LineTime { get; set; }
        public string Mainslock { get; set; }

        public SemIScan(string entryToParse)
            : base(entryToParse) { }

        public override void Parse(string[] fields)
        {
            base.Parse(fields);
            UnProcessedValues.ForEach(kvp =>
            {
                switch (kvp.Key)
                {
                    case "Scan": Scan = kvp.Value;
                        break;
                    case "InternalScan": InternalScan = kvp.Value;
                        break;
                    case "Dwell": Dwell = kvp.Value;
                        break;
                    case "PixelWidth": PixelWidth = kvp.Value;
                        break;
                    case "PixelHeight": PixelHeight = kvp.Value;
                        break;
                    case "HorFieldsize": HorFieldsize = kvp.Value;
                        break;
                    case "VerFieldsize": VerFieldsize = kvp.Value;
                        break;
                    case "FrameTime": FrameTime = kvp.Value;
                        break;
                    case "LineTime": LineTime = kvp.Value;
                        break;
                    case "Mainslock": Mainslock = kvp.Value;
                        break;
                    default:
                        UnknownValues.Add(kvp);
                        break;
                }
            });
        }
    }

    public class SemBSED : BaseSemData
    {
        public SemBSED(string entryToParse)
            : base(entryToParse) { }

        public override void Parse(string[] fields)
        {
            base.Parse(fields);
            UnProcessedValues.ForEach(kvp =>
            {
                switch (kvp.Key)
                {
                    default:
                        UnknownValues.Add(kvp);
                        break;
                }
            });
        }
    }

    public class SEMSTEM_II : BaseSemData
    {

        public string Contrast { get; set; }
        public string Brightness { get; set; }
        public string Signal { get; set; }
        public string ContrastDB { get; set; }
        public string BrightnessDB { get; set; }
        public string Setting { get; set; }
        public string MinimumDwellTime { get; set; }
        public SEMSTEM_II(string entryToParse)
            : base(entryToParse) { }

        public override void Parse(string[] fields)
        {
            base.Parse(fields);
            UnProcessedValues.ForEach(kvp =>
            {
                switch (kvp.Key)
                {
                    case "Contrast": Contrast = kvp.Value;
                        break;
                    case "Brightness": Brightness = kvp.Value;
                        break;
                    case "Signal": Signal = kvp.Value;
                        break;
                    case "ContrastDB": ContrastDB = kvp.Value;
                        break;
                    case "BrightnessDB": BrightnessDB = kvp.Value;
                        break;
                    case "Setting": Setting = kvp.Value;
                        break;
                    case "MinimumDwellTime": MinimumDwellTime = kvp.Value;
                        break;
                    default:
                        UnknownValues.Add(kvp);
                        break;
                }
            });
        }

    }


    public class SemDataParsedResult
    {
        public List<BaseSemData> BaseSemData { get; set; }
        public List<string> UnknownRecords { get; set; }
    }
}
